import { createSlice, PayloadAction, createAsyncThunk } from '@reduxjs/toolkit'
// export const fetchHomeDataAction = createAsyncThunk(
//   'fetchData',
//   (payload, dispatch) => {}
// )

interface ISatate {
  count: number
  message: string
  direction: 'left' | 'right' | 'up' | 'down'
}
const initialState: ISatate = {
  count: 100,
  message: 'hello',
  direction: 'left'
}
const userSlice = createSlice({
  name: 'user',
  initialState,
  reducers: {
    setCount(state, { payload }: PayloadAction<string>) {
      state.count++
    },
    changeMessageAction(state, { payload }: PayloadAction<string>) {
      state.message = payload
    }
  }
})
export const { setCount, changeMessageAction } = userSlice.actions
export default userSlice.reducer
